import { IsNotEmpty, IsEmail } from "class-validator"
import { Transform } from "class-transformer"

// 通过dto进行校验和转换
export class UserDto {
  @IsNotEmpty({ message: '用户名不能为空' })
  @Transform((user) => user.value.trim())
  name: string
  @IsNotEmpty({ message: '邮箱不能为空' })
  @IsEmail({}, { message: '邮箱格式错误' })
  email: string
}